﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Diagnostics;
using System.Windows.Forms;

namespace FreeFlowAdministrator
{
  class EventLogEntryAdaptor : Adaptor
  {
    private EventLogEntry entry;
    public EventLogEntryAdaptor(EventLogEntry entry)
    {
      this.entry = entry;
    }

    public override string Text
    {
      get 
      {
        return entry.Message;
      }
    }

    public override object Object
    {
      get 
      {
        return entry;
      }
    }

    public override Control GetRenderer()
    {
      EventLogEntryControl control = new EventLogEntryControl();
      control.LoadEntry(entry);
      return control;
    }

    public override int ImageIndex
    {
      get
      {
        switch (entry.EntryType)
        {
          case EventLogEntryType.Error: return 15;
          case EventLogEntryType.Warning: return 38;
          case EventLogEntryType.Information: return 37;
          default: return 15;
        }
      }
    }
  }
}
